<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<div class="modal-dialog x-modal-dialog" style="width: 650px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire" title="编辑信息"></i>&nbsp;&nbsp;<span>编辑信息&nbsp;-&nbsp;目标数据</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>
    
    <form id="profile-edit-form" class="form-horizontal" method="POST" action="${ctx.host}/users/${userId}/target-data" data-validate="true">

      <input type="hidden" name="_method" value="PATCH" />
      
      <input type="hidden" name="id" value="${userTargetData.id}" />
      <input type="hidden" name="user.id" value = "${userTargetData.user.id}" />

      <div class="modal-body">

        <div class="form-horizontal bottom-margin-20">
          
          <div class="form-group x-form-group">
            <label class="control-label col-xs-4">目标体重：</label>
            <div class="col-xs-6 pull-left">
              <input name="targetWeight" type="text" class="form-control" value="${userTargetData.targetWeight}" data-validate="required|regp,^\+?(\d*\.\d{1})$" data-validate-regp-message="请精确到小数点后一位(kg)">
            </div>
          </div>
            
          <div class="form-group x-form-group">
            <label class="control-label col-xs-4">目标BMI：</label>
            <div class="col-xs-6 pull-left">
              <input name="targetBmiValue" type="text" class="form-control" value="${userTargetData.targetBmiValue}" data-validate="required|regp,^\+?(\d*\.\d{2})$" data-validate-regp-message="请精确到小数点后两位">
            </div>
          </div>
          
          <div class="form-group x-form-group">
            <label class="control-label col-xs-4">目标达成日期：</label>
            <div class="col-xs-6 pull-left">
              <input type="text" class="form-control date" name="expiryDate" value='<fmt:formatDate value="${userTargetData.expiryDate}" pattern="yyyy-MM-dd"/>' readonly placeholder="请输入目标达成日期" aria-describedby="basic-addon2" data-validate="required">
            </div>
          </div>
          
        </div>
        
      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>
        
    </form>
    
  </div>
</div>

<script>

  $(function() {
    
    $(".date").datetimepicker({
        format: 'yyyy-mm-dd',
        autoclose: true,
        language: 'zh-CN',
        todayBtn: 'linked',
        todayHighlight: true,
        pickerPosition: 'bottom-right',
        minView: 'month'
  })
    
  })
</script>
